package com.foocus.foocuscloud.common.domain;


import com.foocus.foocuscloud.common.exception.ResponseCode;

public class ResponseWrapper {

    private int code;
    private String message;
    private Object data;

    public ResponseWrapper() {
    }

    private ResponseWrapper(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private ResponseWrapper(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public static ResponseWrapper Success() {

        return new ResponseWrapper(ResponseCode.SUCCESS_CODE, ResponseCode.SUCCESS_MESS);
    }

    public static ResponseWrapper Success(String message) {

        return new ResponseWrapper(ResponseCode.SUCCESS_CODE, message);
    }

    public static ResponseWrapper Success(Object data) {

        return new ResponseWrapper(ResponseCode.SUCCESS_CODE, ResponseCode.SUCCESS_MESS, data);
    }

    public static ResponseWrapper Success(String message, Object data) {

        return new ResponseWrapper(ResponseCode.SUCCESS_CODE, message, data);
    }

    public static ResponseWrapper Fail(String message) {

        return new ResponseWrapper(ResponseCode.FAIL_CODE, message);
    }

    public static ResponseWrapper Fail() {

        return new ResponseWrapper(ResponseCode.FAIL_CODE, ResponseCode.FAIL_MESS);
    }

    @Override
    public String toString() {
        return "ResponseWrapper{" +
                "\ncode=" + code +
                ",\nmessage='" + message + '\'' +
                ",\ndata=" + data +
                '}';
    }
}
